package top.zsyle.sycc.fallback;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import top.zsyle.sycc.domain.Login;
import top.zsyle.sycc.exception.GlobalExceptionEnum;
import top.zsyle.sycc.feign.LoginService;
import top.zsyle.sycc.result.JsonResult;

@Component
public class LoginServiceFallbackFactory implements FallbackFactory<LoginService> {
    @Override
    public LoginService create(Throwable throwable) {
        return new LoginService() {
            @Override
            public JsonResult saveOrUpdate(Login login) {
                return JsonResult.error(GlobalExceptionEnum.ERROR.getMessage(),GlobalExceptionEnum.ERROR.getCode());
            }
        };
    }
}
